package com.goblin.model.uaa.controller;

import java.util.List;

import com.goblin.common.response.PageHelper;
import com.goblin.common.response.Paged;
import com.goblin.common.response.Response;
import com.goblin.model.base.BaseController;
import com.goblin.model.uaa.po.Menu;
import com.goblin.model.uaa.po.Priv;
import com.goblin.model.uaa.service.PrivService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/v1/uaa/priv")
public class PrivController extends BaseController<Priv> {

	@Autowired
	private PrivService privService;

	@GetMapping("/privs")
	public Response<Paged<Priv>> paged(PageHelper pageable) {
		Paged<Priv> entities = this.privService.paged(pageable);
		return Response.success(entities);
	}

	/**
	 * @desc: 获取菜单递归结构.
	 * @author goblin
	 * @date 2021/1/19 12:02
	 */
	@GetMapping("/tree")
	public Response<List<Priv>> tree() {
		List<Priv> entities = this.privService.tree();
		return Response.success(entities);
	}

}
